﻿@model RecommandArticleViewModel
@inject ArticleService _articleService
@{
    var articles = await _articleService.GetRecommandArticlesAsync(Model.CategoryId);
}
<h4>@Model.Title</h4>
<hr />
@if (!articles.Any() && Model.ShowEmptyDataTextIfNoData)
{
    <div class="text-center mt-3">@Model.EmptyDataText</div>
}
else
{
<ul class="list-unstyled mt-3">

    @foreach (var item in articles)
    {
        <li class="border-bottom mb-3">
            <div class="float-left">
                <h6><a @if (Model.NewWindow) { <text> target="_blank" </text> } asp-page="./Detail" ifp-route-id="@item.Id">@(item.Title.Substring(0, Model.ArticleTitleCut, "..."))</a></h6>
                <ul class="list-inline mt-3 text-muted text-sm">
                    <li class="list-inline-item"><i class="fa fa-eye"></i> @item.ViewCount</li>
                    <li class="list-inline-item"><i class="fa fa-comments"></i> @item.Comments.Count</li>
                </ul>
            </div>
            <div class="float-right">
                <span class="badge badge-info">@item.CreateTime.ToChineseDateString()</span>
            </div>
            <div class="clearfix"></div>
        </li>
    }
</ul>
}